package com.yxym.arrays_;

import java.util.Arrays;
import java.util.List;

public class ArraysMethod02 {
    public static void main(String[] args) {
        Integer[] arr ={14,20,52,63,89};
        //binarySearch 通过二分法搜索查找，要求必须排好
        //1.使用binarySearch二叉查找
        //2.要求该数组有序的
        //3.不存在就返回return-(low + 1)
        int index = Arrays.binarySearch(arr,60);
        System.out.println("index= " + index);
        Integer[] newArr = Arrays.copyOf(arr,arr.length + 1);
        System.out.println(Arrays.toString(newArr));
        //比较两个数组内容是否一致
        Integer[] arr2 = {20, 30,40};
        boolean equals = Arrays.equals(arr,arr2);
        System.out.println("equals=" + equals);
        //asList将一组值，转换成list
        List asList = Arrays.asList(2,3,4,5);
        System.out.println("asList=" +asList);
        System.out.println("返回asList类型" + asList.getClass());
    }
}
